﻿using System.Collections.Generic;

namespace Enter.Admin.Models
{
    public class SidebarMenu
    {
        public string Controller { get; set; }
        public string Action { get; set; }
        public string Icon { get; set; }
        public string Text { get; set; }
        public string Badge { get; set; }
        public string Label { get; set; }
        public string Img { get; set; }

        public bool Highlight { get; set; }
        public List<SidebarMenu> Children { get; set; }

        public bool Actived(string controller, string action) {
            if (this.Controller == controller && this.Action == action) {
                return true;
            }
            if (this.Children != null) {
                foreach (var cild in this.Children) {
                    var act = cild.Actived(controller, action);
                    if (act) return true;
                }
            }
            return false;
        }
    }
}
